package financier.jfz.com.babycare;

public class MethodToos {
    public static class ResultBean<T1 extends BeanInteface, T2 extends BeanInteface> implements BeanInteface {
        T1 from1;
        T2 from2;
        OperationBean mOperation;

        @Override
        public long getResult() {
            long result = 0L;
            switch (mOperation) {
                case JIA:
                    result = from1.getResult() + from2.getResult();
                    break;
                case JIAN:
                    result = from1.getResult() + from2.getResult();
                    break;
                case CHENG:
                    result = from1.getResult() + from2.getResult();
                    break;
                case CHU:
                    result = from1.getResult() + from2.getResult();
                    break;
            }
            return result;
        }
    }

    public static class IntBean implements BeanInteface {
        private int num;

        public IntBean(int arg) {
            this.num = arg;
        }

        @Override
        public long getResult() {
            return 0;
        }
    }

    public interface BeanInteface {
        long getResult();
    }

    public enum OperationBean {
        JIA(0, "+"),
        JIAN(1, "-"),
        CHENG(2, "x"),
        CHU(3, "÷");
        int type;
        String lab;

        OperationBean(int type, String lab) {
            this.lab = lab;
            this.type = type;
        }
    }
}
